function IsPopOrder(pushV, popV)
{
    // write code here
    var stack = []
    var popIndex = 0
    for(let i of pushV){
      stack.push(i)
      while(stack.length !== 0 && stack[stack.length-1] === popV[popIndex]){
        stack.pop()
        popIndex++
      }
    }
    return stack.length === 0
}
module.exports = {
    IsPopOrder : IsPopOrder
};